package zt.song.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import zt.song.service.StudentService;

/**
 * @Author 宋伟宁
 * @Date 2023/11/23
 * @Version 1.0
 **/
@Controller
@RequestMapping("/student")
public class StudentController {

    @Resource
    private StudentService studentService;

    @GetMapping("/list")
    public String list(Model model,
                       @RequestParam(name = "offset",defaultValue = "1")Integer offset,
                       @RequestParam(name = "pagesize",defaultValue = "4")Integer pagesize) {

        model.addAttribute("list",this.studentService.pagelist(offset,pagesize));
        return "list";
    }

    @GetMapping("/toadd")
    public String toadd(){
        return "add";
    }
}
